<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>发送邮件</title>
</head>
<body>
	<form action="/Home/User/mail" method="post" onsubmit="return false;" id="form">
		账号:<input type="text" name="username" value="" id="uname"><br><br>
		邮箱:<input type="email" name="email" value="" id="email">
		<span id="chkmsg"></span><br><br>
		<button id="btn">点击发送邮件</button>

	</form>
</body>
</html>
<script type="text/javascript" src="/Public/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript">
$('#btn').on('click',function(){
	var uname = $('#uname').val();
	var mail = $('#email').val();
	var preg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
	if(mail=='' || !preg.test(mail))
	{
		$("#chkmsg").html("请填写正确的邮箱!");
	}else{
		$("#btn").attr("disabled","disabled").html("发送中....");
		var url = '/Home/User/mail';
		var data = {'username':uname,'email':mail};
		$.post(url,data,function(res){
			if(res.status == 0)
			{
				$("#chkmsg").html(res.content);
			}
		},'json');
	}
});
</script>